﻿
using UnityEngine;
using System.Collections;

public class EffectRenderQ : MonoBehaviour {
	public bool PlayInUpdate;
	public int depth = 3000;
	Renderer[] render;
	ParticleRenderer[] effectrender;
	// Use this for initialization
	void Start () {
		render = GetComponentsInChildren<Renderer> ();
		effectrender = GetComponentsInChildren<ParticleRenderer> ();
		UpdateRender();
	}
	
	// Update is called once per frame
	void Update () {
		if (PlayInUpdate)
			UpdateRender ();
	}
	void UpdateRender(){
		if (render != null) {
			for (int i = 0; i < render.Length; i++) {
				render [i].material.renderQueue = depth;
			}
		}
		if (render != null) {
			for (int i = 0; i < effectrender.Length; i++) {
				effectrender [i].material.renderQueue = depth;
			}
		}
	}
}
